
/**		
 * 
 *	uk.co.leanmean.net.loading.events.QueueLoaderEvent
 *	
 *	@version 1.00 | Oct 12, 2009
 *	@author Justin Windle
 *  
 **/
 
package uk.co.lmfm.net.loading.events 
{
	import uk.co.lmfm.net.loading.QueueLoaderItem;

	import flash.events.Event;

	/**
	 * QueueLoaderEvent
	 */
	public class QueueLoaderEvent extends Event 
	{
		//	----------------------------------------------------------------
		//	PUBLIC STATIC CONSTANTS
		//	----------------------------------------------------------------

		/**
		 * Dispatched when an error occurs whilst loading a queue item
		 */
		 
		public static const ITEM_ERROR : String = "itemError";
		
		/**
		 * Dispatched when a queue item starts loading
		 */
		
		public static const ITEM_STARTED : String = "itemStarted";
		
		/**
		 * Dispatched then a queue items loading process is stopped
		 */
		
		public static const ITEM_STOPPED : String = "itemStopped";
		
		/**
		 * Dispatched during an items loading phase as bytes are loaded
		 * @see #progress
		 */
		
		public static const ITEM_PROGRESS : String = "itemProgress";
		
		/**
		 * Dispatched when an item has finished loading 
		 */
		
		public static const ITEM_COMPLETE : String = "itemComplete";
		
		/**
		 * Dispatched when an item in a queues priority is changed
		 */
				public static const ITEM_PRIORISED : String = "itemPrioritised";

		/**
		 * Dispatched when a queue starts loading
		 */

		public static const QUEUE_STARTED : String = "queueStarted";
		
		/**
		 * Dispatched when a queue is stopped
		 */
		
		public static const QUEUE_STOPPED : String = "queueStopped";
		
		/**
		 * Dispatched when the entire queue is complete
		 */
		 
		public static const QUEUE_COMPLETE : String = "queueComplete";

		//	----------------------------------------------------------------
		//	PUBLIC MEMBERS
		//	----------------------------------------------------------------

		/**
		 * The current progress if a queue item
		 */
		 
		public var progress : Number = 0.0;
		
		/**
		 * The item that has dispatched this event
		 */
		
		public var item : QueueLoaderItem;
		
		/**
		 * Any message (such as an error message) that may be in this event
		 */
		
		public var text : String = '';

		//	----------------------------------------------------------------
		//	CONSTRUCTOR
		//	----------------------------------------------------------------

		public function QueueLoaderEvent(type : String, bubbles : Boolean = false, cancelable : Boolean = false)
		{
			super(type, bubbles, cancelable);
		}

		//	----------------------------------------------------------------
		//	PUBLIC METHODS
		//	----------------------------------------------------------------
		
		/**
		 * Clones the current event and returns a new event with identical properties
		 */

		override public function clone() : Event
		{
			var copy : QueueLoaderEvent = new QueueLoaderEvent(type, bubbles, cancelable);
			copy.progress = progress;
			copy.item = item;
			copy.text = text;
			
			return copy;
		}
	}
}
